<template>
    <rx-dialog @handOk="handleSubmit" @cancel="cancel">
        <rx-layout>
            <div slot="center">
                <a-form>
                    <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$comi18('rxDialog.name', '标题')">
                        <a-input v-model="title" style="width: 80%"></a-input>
                    </a-form-item>
                    <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="i18n('defValue','默认值')">
                        <a-date-picker
                            style="width: 80%"
                            mode="year"
                            @openChange="openChangeYear"
                            @panelChange="panelChange"
                            :open="dataopen"
                            v-model="value"
                            format="YYYY"
                            :allowClear="false"
                            :getCalendarContainer="p=>p.parentNode"
                        />
                    </a-form-item>
                </a-form>
            </div>
        </rx-layout>
    </rx-dialog>
</template>

<script>
import filter from "./filter";
import dayjs from "dayjs";
export default {
    name: "year-filter",
    mixins:[filter],
    data(){
        return{
            dataopen:false
        }
    },
    methods:{
        i18n(name,text,key){
            return this.$ti18(name,text,"codeGenSetting",key);
        },
        openChangeYear(status) {
            if (status) {
                this.dataopen = true
            } else {
                this.dataopen = false
            }
        },
        panelChange(value) {
            if(!value){
                this.value='';
            }else {
                this.value = dayjs(value).format('YYYY');
            }
            this.dataopen = false
        },
    }
}
</script>

<style scoped>

</style>